{template 'header'}
<script src="../addons/bsht_vcard/res/js/MagicZoom.js"></script>
<div class='container' style='padding: 0 5px 10px; margin: 0; width: 100%'>
	<ul class="nav nav-tabs">
		<li class="active"><a href="{php echo $this->createWebUrl('listuser');}">用户列表</a></li>

		<li><a href="{php echo $this->createWebUrl('listuser_add',array('op'=>'add'));}">添加用户</a></li>
	</ul>

<!--div class="panel panel-info">
	<div class="panel-heading"></div>
</div-->

<div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
        	<input type="hidden" name="m" value="bsht_tbk" />
        	<input type="hidden" name="do" value="listuser" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
				<div class="col-sm-8 col-lg-3">
					<input class="form-control" name="keyword" id="" placeholder="输入昵称、openidID" type="text" value="{$_GPC['keyword']}">
				</div>

				
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
					<div class="col-sm-8 col-lg-2">
						<select name="status" class="form-control">
							<option value="1" {if intval($_GPC['status']) == 1}selected="selected"{/if}>启用</option>
							<option value="0" {if intval($_GPC['status']) == 0}selected="selected"{/if}>禁用</option>
						</select>
					</div>
				

                                <div class=" col-xs-12 col-sm-2 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    &nbsp;&nbsp;
					<a onclick="return confirm('该操作比较耗时，确认吗？'); return false;" href="{php echo $this->createWebUrl('list_user_delall');}" title="删除" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i> 一键清空用户</a>
				</div>
			</div>
 			<div class="form-group">
			</div>
		</form>
		
	</div>
 
    </div>
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr style="width:100%">
				    <th width="80" style="text-align:center">ID</th>	
				    <th width="100" style="text-align:center">排序</th>	
					<th width="20%" style="text-align:left">基础信息</th>
					
					<th width="10%" style="text-align:center">其他信息</th>

					
					<th width="auto" style="text-align:center">统计</th>
					
					<th width="100" style="text-align:center">用户头像</th>
					<th style="width:auto;text-align:center">客服消息</th>

                    <th width="20%" style="text-align:right">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}


                <tr>

                    <td style="text-align:center">{$row['id']}</td>
					<td style="text-align:center">{$row['displayorder']}</td>
					<td style="text-align:left"><span class="label label-xs label-default disabled">UID:{$row['uid']}</span> | <span class="label label-xs label-primary disabled">{$row['nickname']}</span><div style="height:10px"></div><span class="label label-info label-xs">{$row['openid']}</span></td>
					
					<td style="text-align:center">{if $row['status']==1}<span class="label label-success status" id="{$row['id']}">开启</span>{/if}{if $row['status']==0}<span class="label label-danger status" id="{$row['id']}">关闭</span>{/if}{if $row['url']}&nbsp;<span class="label label-info">有海报</span>{else}&nbsp;<span class="label label-danger">无海报</span>{/if}<div style="height:10px"></div><span class="label label-warning"><a href="{php echo $this->createWebUrl('listuser',array('helpid'=>$row['uid']))}" style="color:#fff" target="_blank"><i class="fa fa-credit-card"></i> {if $row['ynum']}{$row['ynum']}{else}0{/if} 邀请</a></span> <span class="label label-success"><a href="{$_W['siteroot']}app/index.php?i={$_W['uniacid']}&c=entry&userid={$row['id']}&do=fav&m=bsht_tbk" style="color:#fff" target="_blank"><i class="fa fa-credit-card"></i> {if $row['vnum']}{$row['vnum']}{else}0{/if} 收藏</a></span></td>


					<td style="text-align:center">资料创建时间：{php echo date('Y-m-d H:i:s',$row['ctime'])}<br>最后访问时间：{php echo date('Y-m-d H:i:s',$row['vtime'])}</td>

					<td style="text-align:center">
					{if !empty($row['avatar'])}
					<a  href="{php echo tomedia($row['avatar'])}" class="MagicThumb">
					<img src="{php echo tomedia($row['avatar'])}" style="height:40px;width:40px"></a>&nbsp;&nbsp;
					{else}
					暂无图片
					{/if}
					</td>


					<td style="text-align:center">{if $row['follow']==1}<a class="label label-success" title="发送客服消息" href="index.php?c=mc&a=notice&do=tpl&id={$row['fanid']}" target="_blank"><i class="fa fa-comment-o"></i> 点击发送</a>{else}<a class="label label-warning" title="用户暂未关注，不能发送客服消息！" href="javascript:"><i class="fa fa-exclamation-circle"></i> 无法使用</a>{/if}{if $row['helpid']}&nbsp;<span class="label label-info"><a href="{php echo $this->createWebUrl('listuser',array('uid'=>$row['helpid']))}" style="color:#fff" target="_blank"><i class="fa fa-lock"></i> 查看上级</a></span>{/if}</td>

<td style="text-align:right">

					

					<a class="btn   btn-default" title="编辑" href="{php echo $this->createWebUrl('listuser_add',array('op'=>'edit','id'=>$row['id']))}" ><i class="fa fa-edit"></i> 编辑</a>
					
					<a class="btn  btn-danger" rel="tooltip" href="javascript:void();" onclick="drop_confirm('您确定要删除吗?删除不可恢复，同时删除所有相关数据！', '{php echo $this->createWebUrl('listuser_del',array('id'=>$row['id']))}');" title="删除"><i class="fa fa-times"></i></a>
</td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>

</div>
<script>
            function drop_confirm(msg, url){
            if (confirm(msg)){
            window.location = url;
            }
            }
$(document).ready(function(){ 
　　$(".status").click(function(){ 

var cid=$(this).attr('id');
var url = "{php echo $this->createWebUrl('listuser_ajax');}&id="+cid;		
$.post(url, function(dat){
dat = eval('('+dat+')');

if (dat.status==1)
{
var cid=dat.id;
$("#"+cid).removeClass("label-danger");
$("#"+cid).addClass("label-success");
$("#"+cid).hide();
$("#"+cid).html('开启').fadeIn(500);
}

if (dat.status==0)
{
var cid=dat.id;
$("#"+cid).removeClass("label-success");
$("#"+cid).addClass("label-danger");
$("#"+cid).hide();
$("#"+cid).html('关闭').fadeIn(500);
}

});
　　　//alert(cid);
　　}); 
}); 
</script>
　
{template 'footer'}